package com.itlong.cloud.enumerate.ecode_en;

import com.itlong.cloud.enumerate.ecode.ErrorCode;
import lombok.Getter;
import lombok.Setter;

/**
 * <desc>
 * DEMO示例。
 * <desc/>
 *
 * @createDate 2017-12-28.
 */
public enum  AppErrorCodeEnumEN {

    /*
   *mainCode为1表示APP模块错误，subCode可用范围为1至999；
  */
    SMSCODE_ERR(1,1,"Please enter the correct verification code"),

    SMSCODE_SEND_ERR(1,3,"Fail to submit"),
    PUB_ACCOUNT_PASSWORD_ERR(3,2,"Error in account or password, please re-enter"),
    EXIST_EMAIL(1,4,"Registered Already"),

    USER_NOT_EXIST(1,5,"Incorrect username or password"),

    USER_TOKEN_ERROR(1,6,"Expired login, please login again"),

    NOT_EXIST_EMAIL(1,9,"Unregistered"),

    OLD_PSWD_ERROR(1,10,"Incorrect original password, please enter again"),

    PROJECT_ID_EMPTY_ERR(1,15,"Illegal project number"),
    PUB_LOGIN_ERROR_ACCOUNT_LOCKED(3,16,"The number of login errors exceeds the maximum limit. The account is temporarily locked. Please try again later."),
    SMSCODE_EXPIRE(1,22,"Expired verification code"),
    PSWD_LENGTH_ERROR(1,23,"Password should be 6-16 digits"),
    PHONE_PSWD_EMPTY(1,24,"The account and password should not be null ,please enter again."),
    FEEDBACK_TOO_LONG(1,25,"Less than 150 characters"),
    PROJECT_NOT_MATCH(1,26,"Item number illegal"),

    OPEN_PASSWORD_IS_NULL(1,37,"Not Null. Please enter again."),
    OPEN_PASSWORD_IS_ERROR(1,38,"Password should be 4 digits"),

    USER_ACCOUNT_REFUSE(1,42,"Account is disabled,Please contact the property."),
    USER_REMIND_REPEAT_LOGIN(1,43,"Your account is registered on other devices. If it is not operated by yourself, the login password may have been leaked. Please login to modify the password."),
    USER_NOT_OWNER(1,44,"You are not the owner,do not have permission to do this operation."),                                                        //标记

    BANNER_TYPE_INVALID(1,47,"The banner type is illegal."),                                                           //标记

    USER_PHONE_IS_NOT_EXIST(1,58,"Unregistered"),

    EMAIL_NOT_REGISTER(1,60,"Unregistered"),
    ACCOUNT_NOT_EXIST_ERR(1,64,"No account exists"),
    EMAIL_FORMAT_ERROR(1,65,"Email format error,please enter again"),
    USER_PROJECT_FREEZE(1,66,"Your authorization is frozen,please contact the management center %s."),
    USER_PROJECT_DISABLED(1,67,"Your authorization is disabled，please contact the management center %s."),
    SMSCODE_SEND_TO_MORE(1,98,"The number of times you get the authentication code is too frequent. Please try again later."),
    APP_SIGN_ERR(1,99,"Error of parameter signature"),
    NOT_PARAM(1,100,"Miss required parameter"),
    OPEN_PASSWORD_IS_WEAK_PASSWORD(1,138,"Your password is weak, please replace it"),
    LOGIN_PASSWORD_IS_ERROR(1,139,"Incorrect login password"),
    PUB_LOGIN_PARAMS_IS_EMPTY(1,154,"Authentication parameter is abnormal"),
    ACCOUNT_NO_PROJECT_ERROR(1,155,"There is no project under the user account"),

            ;
    @Setter
    @Getter
    private ErrorCode errorCode = new ErrorCode();

    @Getter
    private String codeMsg;

    AppErrorCodeEnumEN(){}

    /**
     * <desc>
     *     主错误码与错误信息构造函数
     * </desc>
     * @param mainCode
     * @param codeMsg
     */
    AppErrorCodeEnumEN(Integer mainCode, String codeMsg) {
        errorCode.setMainCode(mainCode);
        errorCode.setSubCode(0);
        errorCode.setCodeMsg(codeMsg);
    }

    /**
     * <desc>
     *     全参构造函数
     * </desc>
     * @param mainCode
     * @param subCode
     * @param codeMsg
     */
    AppErrorCodeEnumEN(Integer mainCode, Integer subCode, String codeMsg){
        this.codeMsg=codeMsg;
        errorCode.setMainCode(mainCode);
        errorCode.setSubCode(subCode);
        errorCode.setCodeMsg(codeMsg);
    }
}
